package Test;

import org.junit.Test;

import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;

import com.demo.service.ClassService;
import com.demo.entity.Class;;
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration("classpath:spring/spring-*.xml")
public class ClassTest {
	@Autowired
	private ClassService classService;
	
	@Test
	public void add()throws Exception{
		Class class1 = new Class();
		class1.setId("c3");
		class1.setClassname("三班");
		Integer addClass = classService.addClass(class1);
		System.out.println(addClass);
	}
	
	@Test
	public void delete()throws Exception{
		Integer deleteClassById = classService.deleteClassById("c3");
		System.out.println(deleteClassById);
	}
	
	@Test
	public void selectById()throws Exception{
		Class selectClassById = classService.selectClassById("c3");
		System.out.println(selectClassById);
	}
	
	/*@Test
	public void selectAll()throws Exception{
		List<Class> selectAllClass = classService.selectAllClass();
		for (Class class1 : selectAllClass) {
			System.out.println(class1);
		}
	}*/
	
	@Test
	public void update()throws Exception{
		Class class1 = classService.selectClassById("c3");
		class1.setClassname("三班_");
		Integer updateClass = classService.updateClass(class1);
		System.out.println(updateClass);
	}
}
